<template>
  <div>
    <el-container>
      <el-header>北京信息技术分公司考核系统登录</el-header>
      <el-main>
        <el-card class="box-card">

          <el-form :label-position="labelPosition" label-width="80px" >
            <el-form-item label="用户名">
              <el-input v-model="user.name"></el-input>
            </el-form-item>
            <el-form-item label="密  码" >
              <el-input v-model="user.pass" type="password"></el-input>
            </el-form-item>

          </el-form>
          <el-button type="primary" @click="login">登录</el-button>


        </el-card>

      </el-main>
    </el-container>

  </div>
</template>

<script>
export default {
  name: 'login',
  data () {
    return {
      labelPosition: 'right',
      user: {
        name: '',
        pass: '',
        },
    }
  },
  methods:{
    login(){
      console.log('123234123')
      var that=this
      Bmob.User.logIn(this.user.name, this.user.pass, {
        success: function(user) {
          alert('登录成功')
          that.$router.push('/')

        },
        error: function(user, error) {
          alert('用户名密码错')
        }
      });



//      if(this.user.name=='wxl'&&this.user.password=='123'){
//        this.$router.push('/')
//      }else{
//        alert('用户名密码错')
//      }


    }

  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.el-main{
  background-color: rgba(79, 149, 255, 0.29);
  height: 350px;
}

  .box-card {
    width: 400px;
    margin: 30px auto;
    padding: 20px;
  }


</style>
